{include file="Public/header" title="成绩列表"/}

<div  id="container"  class="container-fluid">
    <div  class="row-fluid">

        <!-- 左侧导航栏 start -->
        {include file="Public/sidebar"/}
        <!-- 左侧导航栏 end -->

        <div  id="content"  class="span10">
            <div class="pageTit page-header">
                <h1>成绩管理 </h1>
                <div  class="opt">
                    <a  class="btn btn-info"  href="{:U('admin/score/add')}">添加成绩</a>
                </div>
            </div>

            <div class="search">
                <form id="searchForm" name="searchform" class="well form-search" action="" method="post">
                      <span>学生：
                          <select style="width:90px" name="search[std_id]" size="1" style="height:200px;">
                              <option value='0' selected>全部</option>
                              {$student_list = get_list('Student')}
                              {volist name="student_list" id="vo"}
                              <option class="std_option" value="{$vo.Id}" {if
                                      condition="$vo[Id] eq $search[std_id）]" }selected{/if}>{$vo.name}</option>
                              {/volist}
                          </select>
                      </span>
                      <span>课程：
                          <select style="width:90px" name="search[lesson_id]" size="1" style=" height:200px;">
                              <option value='0' selected>全部</option>
                              {$lesson_list = get_list('Lesson')}
                              {volist name="lesson_list" id="vo"}
                              <option class="major_option" value="{$vo.Id}" {if
                                      condition="$vo[Id] eq $search[lesson_id]" }selected{/if}>{$vo.name}</option>
                              {/volist}
                          </select>
                      </span>

                    <input type="submit" class="btn btn-info btn-mini" value="搜索" id="search"/>
                    <a href="{:U('admin/student/import')}" target="_blank" class="btn btn-warning btn-mini">导入</a>
                </form>
            </div>
            <div  class="dataBox">
                <table  class="table table-bordered table-striped center">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>学生姓名</th>
                        <th>课程名称</th>
                        <th>分数</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {if condition="$score_list"}
                    {foreach name="score_list" item="vo" }
                    <tr id="tr_{$vo.Id}">
                        <td><a href="#">{$vo.Id}</a></td>
                        <td>{:get_title('Student',$vo['std_id'])}</td>
                        <td>{:get_title('Lesson',$vo['lesson_id'])}</td>
                        <td>{$vo.score}</td>
                        <td>
                            <a title="编辑" class=" btn btn-mini btn-info js_edit" href="{:U("admin/score/edit?id=$vo[Id]")}">编辑</a>
                            <a title="删除" class=" btn btn-mini btn-danger js_del" id="{$vo.Id}">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    {else/}
                    <tr>
                        <td colspan="13">暂无相关班级信息</td>
                    </tr>
                    {/if}

                    </tbody>
                </table>
            </div>
            {include file="Public/page"/}

        </div>
    </div>
</div>
<script>
    $(function(){
        $('.btn-danger').click(function () {
            var result = confirm("删除是不可恢复的,你确认要删除吗?");
            if (!result) {
                return false;
            }
            else {
                var id = $(this).attr('id')
                $.ajax({
                    type: "post",
                    url: "__APP__/Admin/score/del",
                    async: true,
                    data: {id: id},
                    datatype: "json",
                    success: function (data) {
                        if (data.status == 1) {
                            $("#tr_" + id).remove();
                        }
                        alert(data.data);
                    },
                    error: function () {
                        alert("班级删除失败,请刷新重试");
                    }
                });
            }
        });

    });
</script>
{include file="Public/footer"/}